﻿@model HdipCricketClub.ViewModels.ScorecardInputDataViewModel

@{
    ViewBag.Title = "InputScorecardDetail";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<h2>Input Scorecard Detail</h2>

@using (@Html.BeginForm("InputScorecardDetail", "Scorecard", FormMethod.Post))
{
    @Html.ValidationSummary(false)
    <fieldset>
    <legend>Fixture:</legend>
    <br />
    @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.name)
    vs @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.team_name)<br />
    on @Html.DisplayFor(ModelItem => Model.ScorecardFixture.date)<br />
    @Html.HiddenFor(ModelItem => Model.ScorecardFixture.fixture_id)
    </fieldset>
    <fieldset>
    <legend>Input fixture details:</legend>
    <br />
    <strong>Was the fixture:</strong><br /><br />
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.result_id, 3) Completed 
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.result_id, 2) Abandoned
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.result_id, 1) Called Off
    @Html.ValidationMessageFor(ModelItem => Model.ScorecardHeaderDetail.result_id)
    <br /><br />
    <strong>If the fixture was completed or started and abandoned before completion complete the following:</strong>
    <br /><br />
    Who won the toss:<br /><br />
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.won_toss, true) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) 
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.won_toss, false) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
    @Html.ValidationMessageFor(ModelItem => Model.ScorecardHeaderDetail.won_toss)
    <br /><br />
    Who batted first:
    <br /><br />
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.batted_first, true) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Team.Club.ShortName) 
    @Html.RadioButtonFor(ModelItem => Model.ScorecardHeaderDetail.batted_first, false) @Html.DisplayFor(ModelItem => Model.ScorecardFixture.Opponent.club_name)
    <br />
    </fieldset>
    <fieldset>
    <legend>Input Club Player Details</legend>
    <br />
    <table>
        <tr>
            <th>
                Name:    
            </th>
            <th>
                Batting Position:
            </th>
            <th>
                Bowler Number:
            </th>
        </tr>
        @foreach (var item in Model.ScorecardClubTeam)
        {
            <tr>
                    @Html.HiddenFor(modelItem => item.fixture_id)
                    @Html.HiddenFor(modelItem => item.player_id)
                <td>
                    @Html.DisplayFor(modelItem => item.Member.InitialAndLastName)
                </td>
                <td>
                    @Html.EditorFor(modelItem => item.batsman_number)
                    @Html.ValidationMessageFor(modelItem => item.batsman_number)
                </td>
                <td>
                    @Html.EditorFor(modelItem => item.bowler_number)
                    @Html.ValidationMessageFor(modelItem => item.bowler_number)
                </td>
            </tr>
        }
    </table>
    </fieldset>
    <fieldset>
    <legend>Input Opponent Player Details</legend>
    <br />
    <table>
        <tr>
            <th>
                Batting Position:    
            </th>
            <th>
                Name:
            </th>
            <th>
                Bowler Number:
            </th>
        </tr>
        @foreach (var item in Model.ScorecardOpponentTeam)
        {
            <tr>
                    @Html.HiddenFor(modelItem => item.op_fixture_id)
                    @Html.HiddenFor(modelItem => item.op_batsman_number)
                <td>
                    @Html.DisplayFor(modelItem => item.op_batsman_number)
                    @Html.ValidationMessageFor(modelItem => item.op_batsman_number)
                </td>
                <td>
                    @Html.EditorFor(modelItem => item.op_player_name)
                    @Html.ValidationMessageFor(modelItem => item.op_player_name)
                </td>
                <td>
                    @Html.EditorFor(modelItem => item.op_bowler_number)
                    @Html.ValidationMessageFor(modelItem => item.op_bowler_number)
                </td>
            </tr>
        }
    </table>
    </fieldset>
    <p>
        <input type="submit" value="Enter" />
    </p>
}
